package edu.mju.eduservice.client;

import edu.mju.commonutils.ReturnCode;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Author:wyp
 * @Date:2020/9/14 22:17
 *  FeignClient(name,fallback):
 *      name调用的服务名
 *      fallback（熔断）出错后执行这里面的方法
 */
@Component
@FeignClient(name = "service-vod", fallback = VodFeignCilentImpl.class)
public interface VodClient {
    /**
     * 定义调用服务方法路径
     * PathVariable必需指明参数
     * @param videoId 视频id
     * @return
     */
    @DeleteMapping("/vodService/video/removeVideo/{videoId}")
    ReturnCode removeVideo(@PathVariable("videoId") String videoId);

    /**
     * 删除多个视频的方法
     * @param videoIdList 视频id列表
     * @return
     */
    @DeleteMapping("/vodService/video/deleteAllVideo")
    ReturnCode deleteAllVideo(@RequestParam("videoList") List<String> videoIdList);
}
